package com.nmgs.controller;

import com.nmgs.common.Result;
import com.nmgs.dto.ScreenDto;
import com.nmgs.service.IOutPortService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.servlet.http.HttpServletRequest;
import java.util.List;
import java.util.Map;

@Controller
@RequestMapping("/outPort")
public class OutPortController {

    private IOutPortService iOutPortService;
    @Autowired
    public void setiOutPortService(IOutPortService iOutPortService) {
        this.iOutPortService = iOutPortService;
    }

    @PostMapping("getSetUpList")
    @ResponseBody
    public Result<ScreenDto> getSetUpList(HttpServletRequest request, @RequestBody Map<String, Object> req) throws Exception {
        ScreenDto laneData = iOutPortService.getLaneData(req);
        return Result.success(laneData);
    }
    @PostMapping("getFlowAndMoneyByKH")
    @ResponseBody
    public Result<ScreenDto>  getFlowAndMoneyByKH(HttpServletRequest request, @RequestBody Map<String, Object> req){
        ScreenDto flowAndMoneyByKH = iOutPortService.getFlowAndMoneyByKH(req);
        return Result.success(flowAndMoneyByKH);
    }
    @PostMapping("getFlowAndMoneyByClassno")
    @ResponseBody
    public Result<List<ScreenDto>>  getFlowAndMoneyByClassno(HttpServletRequest request, @RequestBody Map<String, Object> req){
        List<ScreenDto> flowAndMoneyByKH = iOutPortService.getFlowAndMoneyByClassno(req);
        return Result.success(flowAndMoneyByKH);
    }
    @PostMapping("getFlowAndMoneyByExitfee")
    @ResponseBody
    public Result<List<ScreenDto>>  getFlowAndMoneyByExitfee(HttpServletRequest request, @RequestBody Map<String, Object> req){
        List<ScreenDto> flowAndMoneyByKH = iOutPortService.getFlowAndMoneyByExitfee(req);
        return Result.success(flowAndMoneyByKH);
    }
    @PostMapping("getFlowAndMoneyBypayType")
    @ResponseBody
    public Result<ScreenDto>  getFlowAndMoneyBypayType(HttpServletRequest request, @RequestBody Map<String, Object> req){
        ScreenDto flowAndMoneyByKH = iOutPortService.getFlowAndMoneyBypayType(req);
        return Result.success(flowAndMoneyByKH);
    }
    @PostMapping("getFlowAndMoneyByEnname")
    @ResponseBody
    public  Result<List<ScreenDto>>  getFlowAndMoneyByEnname(HttpServletRequest request, @RequestBody Map<String, Object> req){
        List<ScreenDto> flowAndMoneyByKH = iOutPortService.getFlowAndMoneyByEnname(req);
        return Result.success(flowAndMoneyByKH,flowAndMoneyByKH.size());
    }
    @PostMapping("getFlowAndMoneyByTq")
    @ResponseBody
    public  Result<List<ScreenDto>>  getFlowAndMoneyByTq(HttpServletRequest request, @RequestBody Map<String, Object> req){
        List<ScreenDto> flowAndMoneyByKH = iOutPortService.getFlowAndMoneyByTq(req);
        return Result.success(flowAndMoneyByKH,flowAndMoneyByKH.size());
    }
    @PostMapping("getFlowByRobot")
    @ResponseBody
    public  Result<List<ScreenDto>>  getFlowByRobot(HttpServletRequest request, @RequestBody Map<String, Object> req){
        List<ScreenDto> flowAndMoneyByKH = iOutPortService.getFlowByRobot(req);
        return Result.success(flowAndMoneyByKH,flowAndMoneyByKH.size());
    }
    @PostMapping("getFlowAndMoneyByClassdate")
    @ResponseBody
    public  Result<List<ScreenDto>>  getFlowAndMoneyByClassdate(HttpServletRequest request, @RequestBody Map<String, Object> req){
        List<ScreenDto> flowAndMoneyByKH = iOutPortService.getFlowAndMoneyByClassdate(req);
        return Result.success(flowAndMoneyByKH,flowAndMoneyByKH.size());
    }
    @PostMapping("getEveryRateAll")
    @ResponseBody
    public  Result<ScreenDto>  getEveryRateAll(HttpServletRequest request, @RequestBody Map<String, Object> req){
        ScreenDto flowAndMoneyByKH = iOutPortService.getEveryRateAll(req);
        return Result.success(flowAndMoneyByKH,1);
    }


}
